export default class ToolsDec{

    /**
	 * 函数一次执行栈中只能执行一次
	 * @param target
	 * @param propertyKey
	 * @param descriptor
	 */
    static functionDoingOne<T>(target: T, propertyKey: string, descriptor: PropertyDescriptor): void {
	    // 保存函数
	    const setFunction = descriptor.value;
	    let checkClickDealOver = false;

	    descriptor.value = async function(...arg): Promise<void> {
	    	if (checkClickDealOver) {return;}
		    checkClickDealOver = true;
		    const back = await setFunction.apply(this, arg);
		    checkClickDealOver = false;
		    return back;
	    };
    }
}
